package com.michael.baseketball.ui.main

import android.os.Bundle
import androidx.lifecycle.Observer
import com.michael.baseketball.R
import com.michael.baseketball.base.BaseFragment
import com.michael.baseketball.databinding.FragmentMainBinding
import com.michael.baseketball.ext.init
import com.michael.baseketball.ext.initMain
import com.michael.baseketball.ext.interceptLongClick
import com.michael.baseketball.ext.setUiTheme
import kotlinx.android.synthetic.main.fragment_main.*

import me.hgj.jetpackmvvm.ext.nav
import me.hgj.jetpackmvvm.ext.util.loge

/**
 * 时间　: 2022/11/1
 * 作者　: michael_ray(1287587036@qq.com)
 * 描述　: 项目主页
 */
class MainFragment : BaseFragment<MainViewModel, FragmentMainBinding>() {

    override fun initView(savedInstanceState: Bundle?) {
        //初始化viewpager2
        mainViewpager.initMain(this)
        //初始化 bottomBar
        mainBottom.init{
            when (it) {
                R.id.menu_news -> mainViewpager.setCurrentItem(0, false)
                R.id.menu_match -> mainViewpager.setCurrentItem(1, false)
                R.id.menu_about_basketball -> mainViewpager.setCurrentItem(2, false)
                R.id.menu_fans_of_ball -> mainViewpager.setCurrentItem(3, false)
                R.id.menu_team -> mainViewpager.setCurrentItem(4, false)
                R.id.menu_mine -> mainViewpager.setCurrentItem(4, false)
            }
        }
        mainBottom.interceptLongClick(R.id.menu_news,R.id.menu_match,R.id.menu_about_basketball,R.id.menu_fans_of_ball,R.id.menu_team,R.id.menu_mine)
    }

    override fun createObserver() {

    }

    override fun layoutId()=R.layout.fragment_main
}